﻿using System.Data;
using System.Data.SQLite;
using System.IO;

namespace YandexWebmaster
{
    public partial class BD
    {
        protected string Name { get; set; }

        public BD() {
            Name = "data.db";
        }

        protected DataTable GetTable(string table, string query)
        {
            using (var connection = new SQLiteConnection($"Data Source={Directory.GetCurrentDirectory()}\\{Name};Version=3;"))
            {     
                SQLiteDataAdapter da = new SQLiteDataAdapter(query, connection);
                DataTable ds = new DataTable();
                da.Fill(ds);                
                dynamic result = ds;
                return result;
            }
        }        
    }
}
